home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
manchest.lha
/
MANCHESTER
/
usenet
/
st80_pre4
/
new-inst-var.st
< prev
next >
Wrap
Text File
|
1993-07-24
|
3KB
|
99 lines
" NAME new-inst-var
AUTHOR paul@pplace.COM (Paul Alderman)
FUNCTION Hints on how to add instance variables to system classes
ST-VERSIONS
PREREQUISITES
CONFLICTS
DISTRIBUTION world
VERSION 1.1
DATE 22 Jun 1988
SUMMARY Description of how to add anew instance variable to Process
"
'
From: paul@pplace.COM (Paul Alderman)
Newsgroups: comp.lang.smalltalk
Subject: Adding a new instance variable to class Process
Message-ID: <343@pplace.COM>
Organization: ParcPlace Systems, Palo Alto CA
This message is in response to Colin Kendall''s question about adding a
new instance variable to a Process. I thought I would post this for
others who might be interested.
To add a new instance variable to Process, fileIn the following, replacing
*newInstVarName* with the instance variable name of your choice.
Paul Alderman
ParcPlace Systems
support@ParcPlace.com
....!!sun!!pplace!!support
---comment added by your moderator:
None of the stuff in here is really necessary...all you need do is:
[Process addInstVarName: ''newVar''] forkAt: Processor highIOPriority
and newVar gets added to Process. Repeat as necessary,.
MIW, 2/5/89
'
"Define a couple methods temporarily."!
!Behavior methodsFor: 'accessing'!
methodDictionary
^ methodDict! !
!ClassDescription methodsFor: 'organization'!
organization: aClassOrganizer
organization _ aClassOrganizer! !
"Rename existing class."
Process rename: #OldProcess.!
"Create the new class."
Link subclass: #Process
instanceVariableNames: 'suspendedContext priority myList *newInstVarName* '
classVariableNames: ''
poolDictionaries: ''
category: 'Kernel-Processes'.!
"Copy methods and method organizations."
Process methodDictionary: OldProcess methodDictionary copy.!
Process organization: OldProcess organization copy.!
Process class methodDictionary: OldProcess class methodDictionary copy.!
Process class organization: OldProcess class organization copy.!
"Remove temporary methods."
Behavior removeSelector: #methodDictionary.!
ClassDescription removeSelector: #organization:.!
"Swap References."
( Smalltalk associationAt: #OldProcess )
become: ( Smalltalk associationAt: #Process )!
"Rehash the System Dictionary."
Smalltalk rehash.!
"Recompile in the new class."
Process compileAll.!
Process class compileAll.!
"Finish the transformation."
[
"Mutate old processes into new processes."
Process updateInstancesFrom: OldProcess.
"Remove old class."
OldProcess removeFromSystem.
SystemOrganization removeElement: #OldProcess.
] forkAt: Processor highIOPriority.!
"Reset the display."
Cursor normal show.
ScheduledControllers searchForActiveController.!